package com.it.common.utils

import android.app.Activity

object ActivityUtils {

    val activityList = mutableListOf<Activity>()
    fun addActivity(act: Activity) {
        activityList.add(act)
    }

    fun removeActivity(act: Activity) {
        activityList.removeIf { act == it }
    }

    fun finishAll() {
        activityList.forEach {
            it.finish()
        }
    }

    fun finishAllExit(clazzName: String) {
        activityList.forEach {
            if (it.javaClass.simpleName != clazzName) {
                it.finish()
            }

        }
    }
}